package com.xiaofengstu.mcams.web.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaofengstu.mcams.dto.BasicResultDTO;
import com.xiaofengstu.mcams.enums.RespStatusEnum;
import com.xiaofengstu.mcams.web.entity.TLog;
import com.xiaofengstu.mcams.web.service.TLogService;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.aspectj.weaver.ast.Var;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fengzeng
 * @since 2022-05-21
 */
@RestController
@RequestMapping("/web/log")
@RequiredArgsConstructor
public class TLogController {

  private final TLogService logService;

  @GetMapping("/list")
  public BasicResultDTO<?> getLogList(@Param("page") Integer page,@Param("size") Integer size) {
    IPage<TLog> ipage = new Page<>(page, size);
    QueryWrapper<TLog> qw = new QueryWrapper<TLog>().orderByDesc("create_time");
    return new BasicResultDTO<>(RespStatusEnum.SUCCESS, logService.page(ipage,qw));
  }

}
